package nj.yb.entity.group;

import com.alibaba.fastjson.annotation.JSONField;

import java.time.LocalDateTime;

public class GroupMember {
    @JSONField(ordinal = 1)
    private Long id;
    @JSONField(ordinal = 2)
    private Long groupId;
    @JSONField(ordinal = 3)
    private String username;
    @JSONField(ordinal = 4)
    private LocalDateTime joinTime;
    @JSONField(ordinal = 5)
    //角色：0-普通成员，1-管理员，2-创建者
    private Integer role;

    public GroupMember(Long groupId, String username, LocalDateTime joinTime, Integer role) {
        this.groupId = groupId;
        this.username = username;
        this.joinTime = joinTime;
        this.role = role;
    }

    public GroupMember(Long id, Long groupId, String username, LocalDateTime joinTime, Integer role) {
        this.id = id;
        this.groupId = groupId;
        this.username = username;
        this.joinTime = joinTime;
        this.role = role;
    }

    public GroupMember() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getGroupId() {
        return groupId;
    }

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public LocalDateTime getJoinTime() {
        return joinTime;
    }

    public void setJoinTime(LocalDateTime joinTime) {
        this.joinTime = joinTime;
    }

    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    @Override
    public String toString() {
        return "GroupMember{" +
                "id=" + id +
                ", groupId=" + groupId +
                ", username='" + username + '\'' +
                ", joinTime=" + joinTime +
                ", role=" + role +
                '}';
    }
}
